﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 结算记录表
/// </summary>
[Table("SettlementRecord")]
[Index("SettlementNo", Name = "idx_SettlementNo", IsUnique = true)]
public partial class SettlementRecord
{
    /// <summary>
    /// 结算记录ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 结算记录编号
    /// </summary>
    [StringLength(32)]
    public string SettlementNo { get; set; } = null!;

    /// <summary>
    /// 结算日期(只取日期部分时间为 00:00:00)
    /// </summary>
    [Column(TypeName = "timestamp(0) without time zone")]
    public DateTime SettlementDate { get; set; }

    /// <summary>
    /// 结算类型(0=自动,1=手动结算)
    /// </summary>
    public int SettlementType { get; set; }

    /// <summary>
    /// 商户ID
    /// </summary>
    [StringLength(32)]
    public string MerchantId { get; set; } = null!;

    /// <summary>
    /// 总实收金额
    /// </summary>
    public long TotalActualReceivedAmount { get; set; }

    /// <summary>
    /// 总退款金额
    /// </summary>
    public long TotalRefundAmount { get; set; }

    /// <summary>
    /// 总结算金额
    /// </summary>
    public long TotalSettledAmount { get; set; }

    /// <summary>
    /// 结算状态(0=结算失败,1=结算成功)
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 失败原因
    /// </summary>
    public string? FailureReason { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 结算笔数
    /// </summary>
    public int? SettlementCount { get; set; }

    /// <summary>
    /// 退款笔数
    /// </summary>
    public int? RefundCount { get; set; }

    /// <summary>
    /// 优惠总金额
    /// </summary>
    public long? TotalDiscountAmount { get; set; }

    /// <summary>
    /// 优惠笔数
    /// </summary>
    public int? DiscountCount { get; set; }

    /// <summary>
    /// 手续费
    /// </summary>
    public long? Commission { get; set; }

    /// <summary>
    /// 平台服务费
    /// </summary>
    public long? PlatformServiceFee { get; set; }
}
